﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BDSim
{
    public class InjectionStationDataProvider:BDSimDataProvider
    {
        private InjectionStation _Parent;

        public InjectionStation Parent
        {
            get { return _Parent; }
            set { _Parent = value; }
        }

        #region 命令定义
        public override void DefineCommand()
        {
            MenuCommand mcdDelete = new MenuCommand() { Header = "删除" };
            mcdDelete.DefineExcuteCommand(mcdDelete_Execute, mcdDelete_CanExecute);
            MenuCommandList.Add(mcdDelete); 
        }
        #endregion



        #region 命令执行方法

        #region 删除命令执行方法
        /// <summary>
        /// 删除接收机功能命令执行方法
        /// </summary>
        /// <param name="param"></param>
        void mcdDelete_Execute(object param)
        {
            Parent.Parent.StationList.Remove(Parent);
        }
        /// <summary>
        /// 删除接收机功能命令可执行控制
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        bool mcdDelete_CanExecute(object param)
        {
            bool flag = true;

            return flag;
        }

        #endregion


        #region 执行方法模板
        /// <summary>
        /// XXX 功能命令执行方法
        /// </summary>
        /// <param name="param"></param>
        void XXX_Execute(object param)
        {

        }
        /// <summary>
        /// XXX功能命令可执行控制
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        bool XXX_CanExecute(object param)
        {
            bool flag = true;

            return flag;
        }
        #endregion

        #region 钟差报告执行方法
        /// <summary>
        /// XXX 功能命令执行方法
        /// </summary>
        /// <param name="param"></param>
        void ClockReport_Execute(object param)
        {
            DataReportView dataPreview = new DataReportView();
            List<ClkSimData> InterSatClkErrList = new List<ClkSimData>();
            InterSatClkErrList = Parent.GenerateStepCLKErr();
            dataPreview.InitClkData(InterSatClkErrList, Parent.Name);
            MainDispatcher.DlgAddLayoutDocument(dataPreview, Parent.Name);
        }
        /// <summary>
        /// XXX功能命令可执行控制
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        bool ClockReport_CanExecute(object param)
        {
            bool flag = false;
            if (BDSimObject.GlobalStatus == ESimStatus.Inited || BDSimObject.GlobalStatus == ESimStatus.Pause)
            {
                flag = true;
            }
            return flag;
        }
        #endregion

        #region 钟差绘图执行方法
        /// <summary>
        /// XXX 功能命令执行方法
        /// </summary>
        /// <param name="param"></param>
        void ClockFigure_Execute(object param)
        {
            DataFigureView clkFigureView = new DataFigureView();
            List<ClkSimData> InterSatClkErrList = new List<ClkSimData>();
            InterSatClkErrList = Parent.GenerateStepCLKErr();
            clkFigureView.InitClkCharts(Parent.Name, InterSatClkErrList);
            MainDispatcher.DlgAddLayoutDocument(clkFigureView, Parent.Name + "_钟差图表");
        }
        /// <summary>
        /// XXX功能命令可执行控制
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        bool ClockFigure_CanExecute(object param)
        {
            bool flag = false;
            if (BDSimObject.GlobalStatus == ESimStatus.Inited || BDSimObject.GlobalStatus == ESimStatus.Pause)
            {
                flag = true;
            }
            return flag;
        }
        #endregion

        #endregion
    }
}
